import cv2 
def rtsp():
    cap = cv2.VideoCapture("rtsp://admin:swls2016@192.168.18.20:554/ch1/sub/av_stream")
    #    const std::string videoStreamAddress = "rtsp://admin:swlskjyxgs0617@192.168.31.111:554/h264/ch34/main/av_stream";
    print("s")

    ret,frame = cap.read()
    while ret:
        ret,frame = cap.read()
        cv2.imshow("frame",frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    cv2.destroyAllWindows()
    cap.release()

def video_capture():
    # cap = cv2.VideoCapture(0)
    cap = cv2.VideoCapture("rtmp://140.246.93.130:1935/vod/openUrl/mBLVC3C?beginTime=20210605T174929&endTime=20210605T175029&playBackMode=1")
    #    const std::string videoStreamAddress = "rtsp://admin:swlskjyxgs0617@192.168.31.111:554/h264/ch34/main/av_stream";
    print("s")

    ret,frame = cap.read()
    while ret:
        ret,frame = cap.read()
        print(frame.shape)
        # cv2.imshow("frame",frame)
        # if cv2.waitKey(1) & 0xFF == ord('q'):
        #     break
    # cv2.destroyAllWindows()
    cap.release()

if __name__ == "__main__":
    video_capture()